import request from "./comm.js";

// 登录凭证校验
export function restWechat(params) {
	return request({
		url: "/rest/wechat",
		method: "POST",
		data: params
	});
}

// 保存用户基本信息
export function restUserCenter(params) {
	return request({
		url: "/rest/user/center",
		method: "POST",
		data: params
	});
}

// 获取用户基本信息
export function restUserCenterByUserId() {
	return request({
		url: "/rest/user/center/"+getApp().globalData.wxlogin.userId,
		method: "GET"
	});
}

// 我的收货地址
export function restUserAddress(params) {
	return request({
		url: "/rest/user/address",
		method: "GET",
		data: params
	});
}

// 保存收货地址
export function restUserAddressSave(params) {
	return request({
		url: "/rest/user/address/save",
		method: "POST",
		data: params,
		type: 2
	});
}

// 删除地址
export function restUserAddressDelete(params) {
	return request({
		url: "/rest/user/address",
		method: "DELETE",
		data: params,
	});
}

// 设为默认地址
export function restUserAddressDefault(params) {
	return request({
		url: "/rest/user/address/default",
		method: "PUT",
		data: params,
	});
}

// 用户的推广二维码
export function restWechatGetShareCode() {
	return request({
		url: "/rest/wechat/getShareCode/"+getApp().globalData.wxlogin.userId,
		method: "GET"
	});
}